import React, {PropTypes} from 'react';

const propTypes = {
	item: PropTypes.object,
	onEdit: PropTypes.func.isRequired,
	onDelete: PropTypes.func.isRequired,
}

function ItemShowLayer({item, onEdit, onDelete}) {
	if(!item || !item.id){
		return (
			<div>
			<h1>select article on left</h1>
			<div></div>
			</div>
			);
	}

	return (
		<div>
		<h1>{item.title}</h1>
		<div>{item.content}</div>
		<div>
			<button onClick={() => onEdit(item.id)} defaultValue="Edit">Edit</button>
			<button onClick={() => onDelete(item.id)} defaultValue="Delete">Delete</button>
		</div>
		</div>
		);
}

ItemShowLayer.propTypes = propTypes;

export default ItemShowLayer;